﻿/********************************************************************************************************************
* Author:	Christos Polydorou																						*
* Email:	std04237@di.uoa.gr																						*
* Purpose:	This script is used in order to create the stored procedure "usp_getEntity".							*
********************************************************************************************************************/

CREATE PROCEDURE [dbo].[usp_getEntity]
	@entityid bigint
AS
	SELECT entities.name,attributes.name,[entity-attribute].value, Entities.Category, Entities.IsApproved, Attributes.Type, Attributes.BestValue, Attributes.ID
	FROM entities,attributes,[entity-attribute]
	WHERE entities.ID = @entityid and
		entities.category = attributes.category and
		[entity-attribute].entity = entities.id and
		[entity-attribute].attribute = attributes.id

RETURN 0